config := meta.(*Config)

// current import_formats can't import fields with forward slashes in their value
if err := parseImportId([]string{"(?P<policy_id>.+)"}, d, config); err != nil {
	return nil, err
}

nameParts := strings.Split(d.Get("policy_id").(string), "/")
if len(nameParts) != 6 {
	return nil, fmt.Errorf(
			"Saw %s when the import ID is expected to have shape %s",
			d.Get("policy_id").(string),
			"locations/global/securityPolicies/{{policy_id}}/priority/{{priority}}",
		)
}
if err := d.Set("policy_id", fmt.Sprintf("locations/global/securityPolicies/%s", nameParts[3])); err != nil {
	return nil, fmt.Errorf("Error setting policy_id: %s", err)
}

if prio, err := strconv.ParseInt(nameParts[5], 10, 64); err != nil {
	return nil, fmt.Errorf(
		"Priority %s cannot be converted to integer", nameParts[5],
	)
} else {
	if err := d.Set("priority", prio); err != nil {
		return nil, fmt.Errorf("Error setting priority: %s", err)
	}
}

return []*schema.ResourceData{d}, nil
